from starlette.endpoints import HTTPEndpoint
from starlette.responses import JSONResponse

from database import Session, engine
import datetime
from dao import DaoEquipVenderProRep



class EquipVenderProRep(HTTPEndpoint):

    async def get(self, request):
        session = Session()
        try:
           bureauid = request.query_params["bureauid"]
           classifyid = request.query_params["classifyid"]
           return  DaoEquipVenderProRep.get_equip_pro(session, bureauid, classifyid)
        finally:
            session.close()

class EquipVenderProRepDetail(HTTPEndpoint):

    async def get(self, request):
        session = Session()
        try:
           bureauid = request.query_params["bureauid"]
           classifyid = request.query_params["classifyid"]
           pro_classifyid = request.query_params["pro_classifyid"]
           return DaoEquipVenderProRep.get_equip_vender_pro(session, bureauid, classifyid, pro_classifyid)
        finally:
            session.close()
